<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();
</script>
<body id="body">

    <!-- Test image map -->
    <map id="apple" name="imagemap1">
      <area shape="rect" coords="10,10,133,72" href="http://www.apple.com" title="Link1" />
      <area shape="rect" coords="12,74,134,88" href="http://www.apple.com" title="Link2" />
      <area shape="rect" coords="11,91,133,105" href="http://www.apple.com" title="Link3" />
      <area shape="default" nohref="nohref" alt="" />
    </map>

    <img src="resources/cake.png"  border="0" align="left" usemap="#imagemap1" vspace="1">

<p id="description"></p>
<div id="console"></div>

    <script>
        description("This tests that you can reach the links within an image map.");

        if (window.accessibilityController) {
            document.getElementById("body").focus();

            var body = accessibilityController.accessibleElementById('body');
            var container = body.childAtIndex(0);

            shouldBe("container.role", "'AXRole: AXImage'");


            shouldBe("container.childAtIndex(0).role", "'AXRole: AXLink'");
            shouldBe("container.childAtIndex(0).name", "'Link1'");

            shouldBe("container.childAtIndex(1).role", "'AXRole: AXLink'");
            shouldBe("container.childAtIndex(1).name", "'Link2'");

            shouldBe("container.childAtIndex(2).role", "'AXRole: AXLink'");
            shouldBe("container.childAtIndex(2).name", "'Link3'");
        }
</script>

</body>
</html>
